package com.kll.tv.views

import android.content.Intent
import android.view.View
import com.kll.carolinehmibiz.presentation.BasePresenter
import com.kll.tv.base.views.BaseActivity
import com.kll.tv.databinding.ActivityUpdatePhoneBinding
import com.tencent.qcloud.tuicore.util.SoftKeyBoardUtil

/**
 * 更换手机号页
 */
class UpdatePhoneActivity: BaseActivity<BasePresenter>() {
    private lateinit var binding: ActivityUpdatePhoneBinding

    override fun initViewBinding(): View {
        binding = ActivityUpdatePhoneBinding.inflate(layoutInflater)
        return binding.root
    }

    override fun createPresenter(): BasePresenter {
        return BasePresenter(this)
    }

    override fun init() {

        initListener()
    }

    private fun initListener() {
        binding.tvCancel.setOnClickListener { finish() }
        binding.ivBackCircular.setOnClickListener {
            startActivity(Intent(this, MainActivity::class.java))
            finish()
        }

        binding.edtPhone.setOnFocusChangeListener(object : View.OnFocusChangeListener {
            override fun onFocusChange(v: View?, hasFocus: Boolean) {
                if (!hasFocus) {
                    SoftKeyBoardUtil.hideKeyBoard(binding.edtPhone.windowToken)
                } else {
                    SoftKeyBoardUtil.showSoftInput(binding.edtPhone)
                }
            }

        })
    }

}